home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- * "eupplay.cci" : EUP データの演奏
- *************************************************************************/
-
- #include "ccilib.h"
-
- /* パレットデータ(HEwin 配色) */
- char PltDat[3][16] =
- {
- /* G R B */
- { 0, 0, 0}, /* C_BALCK, C_THROUGH */
- { 0, 0, 0}, /* C_BLUE , C_MBLACK */
- { 7, 7, 8}, /* C_RED */
- {12,12,13}, /* C_MAGENTA */
- { 6, 5, 7}, /* C_GREEN */
- { 8, 7, 9}, /* C_CYAN */
- {10, 9,11}, /* C_YELLOW */
- {11,11,12}, /* C_WHITE */
-
- { 5, 5, 6}, /* C_HBALCK */
- { 0, 0,11}, /* C_HBLUE */
- { 0,11, 0}, /* C_HRED */
- { 0,11,11}, /* C_HMAGENTA */
- {11, 0, 0}, /* C_HGEEN */
- {11, 0,11}, /* C_HCYAN */
- {11,11, 0}, /* C_HYELLOW */
- {14,14,15} /* C_HWHITE */
- };
-
- char *SndPtr = NULL;
-
- int set_title()
- {
- DSP_writePage(1); /* 書き込みページ */
- DSP_setPlt( PltDat ); /* パレット設定 */
- DSP_title("EUPPLAY","0.99",C_HWHITE,C_WHITE,C_MBLACK,C_HBLACK);
- evt_setDspTime( 1, 432, 4, C_WHITE, C_MBLACK ); /* 時刻表示アイドリング処理設定 */
- SYL_clear();
- }
-
- /*************************************************************************
- * 初期化
- *************************************************************************/
-
- int init()
- {
- if ( (SndPtr = calloc(16384,1)) == NULL )
- exit(1); /* error */
- SND_init( SndPtr ); /* サウンドBIOS初期化 */
- EUP_init(1); /* EUP の初期化 */
-
- DSP_sysInit(0); /* 表示システム初期化 */
- KBF_sysInit(); /* キーボードシステム初期化 */
- KBF_kan_off();
- FDL_sysInit(); /* ファイルダイアログ初期化 */
-
- sdk_control(0); /* サイドワーク起動禁止 */
-
- DSP_writePage(0); /* 書き込みページ */
- DSP_setPlt( PltDat ); /* パレット設定 */
- DSP_boxf(0,24,639,463,PSET,COLMIX(5,6));
-
- set_title();
- }
-
- /*************************************************************************
- * 終了
- *************************************************************************/
-
- int term()
- {
- FDL_sysEnd();
- KBF_sysEnd();
- DSP_sysEnd();
- EUP_term(1);
- if ( SndPtr )
- {
- SND_end();
- free(SndPtr);
- SndPtr = NULL;
- }
- }
-
- /*************************************************************************
- * EUP データの演奏
- *************************************************************************/
-
- int eup_play()
- {
- int i, x, y, ret, mute, x0, y0;
- int meas, meas2, clk;
- char *fdl;
- char *fn;
- char *dlg;
- char *eupSqr;
-
- eupSqr = NULL;
- x = y = DLGPOS_CENTER_OF_SCN;
- if ( (fdl = FDL_open(0)) == NULL )
- return (ERR);
- FDL_set_title( fdl, "EUP PLAY");
- FDL_set_wildcard( fdl, "*.eup");
- for(;;)
- {
- ret = FDL_start(fdl);
- if ( ret != NORMAL )
- break;
- fn = FDL_get_filename(fdl);
- if ( *fn == '\0' )
- continue;
-
- if ( (eupSqr = EUP_open()) == NULL )
- {
- FDL_close(fdl);
- return (ERR);
- }
- if ( EUP_load( eupSqr, fn ) )
- {
- MNU_sure( x, y, C_MBLACK, C_DLGBASE, COLMIX(C_ERROR,C_GRAY),
- SELBTN_ATT_CENTER, " %s \n EUP LOAD ERROR!! ", fn );
- } else
- {
- if ( EUP_setup(eupSqr) )
- {
- MNU_sure( x, y, C_MBLACK, C_DLGBASE, COLMIX(C_ERROR,C_GRAY),
- SELBTN_ATT_CENTER, " %s \n EUP SETUP ERROR!! ", fn );
- }
- SND_get_elevol_mute(&mute);
- SND_elevol_mute(mute | 3);
- EUP_play(eupSqr,0,0);
- meas2 = -1;
- while ( EUP_getPlayFlag(eupSqr) )
- {
- EUP_getPlayMeasClock(eupSqr,&meas,&clk);
- if ( meas != meas2 )
- {
- SYL_puts(C_HGREEN,"meas %4d", meas + 1 );
- meas2 = meas;
- }
- if( kbhit() || MOS_pget(&x0,&y0) )
- break;
- EVT_idl();
- }
- SYL_clear();
- SND_elevol_mute(mute);
- EUP_stop(eupSqr);
- }
- if ( eupSqr )
- {
- EUP_close(eupSqr);
- eupSqr = NULL;
- }
- while ( MOS_pget(&x0,&y0) )
- ;
- KBF_clear();
- }
- FDL_close(fdl);
-
- return (NORMAL);
- }
-
- /*************************************************************************
- * MAIN
- *************************************************************************/
-
- int main( int argc, char **argv )
- {
- init();
-
- eup_play();
-
- term();
- return (0);
- }
-